import java.util.Scanner;

public class TestOut {
    public static void main( String[] args ) {
        Scanner scn = new Scanner(System.in);
        int x = scn.nextInt();
        while ( x >= 0 ) {
            int tx = x;
            int mx = -1;
            while ( tx > 0 ) {
                if (tx % 10 > mx) {
                    mx = tx % 10;
                }
                tx = tx / 10;
            }
            System.out.println(x + "的构成数字中最大的数字是：" + mx);
            x = scn.nextInt();
        }
        scn.close();
    }
}
